package com.example.example4;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity1_layout);
        final EditText editValue= (EditText) findViewById(R.id.value_edit);
        final Button sendbtn=  (Button) findViewById(R.id.button);
        sendbtn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				String value=editValue.getText().toString();
				Long l;
				if(value!=null|| !"".equals(value))
				{
					l= Long.parseLong(value);
				}
				else
					l=0l;
				
				Bundle sendBdl=new Bundle();
				sendBdl.putLong("value", l);
				
				Intent i= new Intent(MainActivity.this,Activity2.class);
				i.putExtras(sendBdl);
				startActivity(i);
				
				finish();
			}
		});
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
